home *** CD-ROM | disk | FTP | other *** search
- /* seq_nocase: */
- /* perform case-insensitive comparison of null-terminated ASCII strings */
- /* return 0 if not equal, 1 if equal */
- /* BUG: shows a match when one string terminates as a subset of another, */
- /* but this doesn't affect usability in this context */
-
- int seq_nocase (str1, str2)
- char *str1, *str2;
- {
- char cv1, cv2;
-
- for ( ; ((*str1 != '\0') && (*str2 != '\0')); str1++, str2++)
- {
- cv1 = ((*str1 >= 'a') && (*str1 <= 'z')) ?
- (0X7F & (*str1 - ('a' - 'A'))) : *str1;
- cv2 = ((*str2 >= 'a') && (*str2 <= 'z')) ?
- (0X7F & (*str2 - ('a' - 'A'))) : *str2;
- if (cv1 != cv2)
- { /* chars unequal */
- return (0);
- }
- }
- /* if we get here, all characters were equal */
- return (1);
- }
-